<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<s:if test="userDetial.username!=''">
<s:property value="userDetial.username"/>
</s:if>
<s:else>
<s:property value="userDetial.eusername"/>
</s:else>
评论
</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/tools/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
 function addFriend(id)
		 {
		    $.post("groupbyajax/user!addFriend.action",{id:id,flag:2},function(data){
		        
		        
		         if(data.success==true)
		         {
		            alert("关注成功！");
		         }else if(data.success=="error")
		         {
		           alert("不能关注自己！");
		         }else if(data.success==false)
		         {
		           alert("已经关过！");
		         }else
		         {
		            alert("请登录！");
		         }
		    });
		 }
  function startSubmit()
  {
    var content=$.trim($("#content").val());
    var login='<s:property value='#session.user.email'/>'
    if(login=="")
    {
       alert("请登录！");
       return false;
    }
    if(content.length<=0||content.length>300)
    {
       alert("评论字数必须在1~300之间!");
    }else
    {
      $("#form").submit();
    }
     
  }
  
  
</script>
</head>

<body>

<div class="container">


<jsp:include page="../head.jsp"/> 
<div class="ge"></div>

<div class="content">
<div class="wrap">
      <div class="left">
	        <div class="bannern2">
			     <div class="bannern_top">
				 </div>
				 <div class="bannern_con">
				      <div class="bannern_left">
				      <a href="user/user!brandUserPage.action?currentPage=1&userId=<s:property value='userId'/>" target="_parent">
				       <s:if test="userDetial.image.equals('')">
				          <img src="images/img.gif"  class="img4" width="240"  height="203"/>
				      </s:if>
				      <s:else>
				         <img src="uploadFile/<s:property value="userDetial.image"/>" class="img4" width="240"  height="203"/>
		 </s:else>
		 </a>
					  <center><a href="javascript:addFriend(<s:property value="id"/>);" target="_parent" class="zi">关注</a></center>
				
					  </div>
					  <div class="bannern_right">
					  品牌分类：<s:property value="userDetial.categoryName"/><br/>品牌名称：<s:property value="userDetial.username"/><br/><s:property value="userDetial.describale" escape="false"/>
					  </div>
					  <div class="clear"></div>
				 </div>
			</div>
	    
		
		 <div class="box3">  
		   
			  <div class="box3_con">
			  <ul class="ul2">
			     <s:iterator value="#request.groupbyCriticismList" id="id" status="status">
			             <s:if test="#id[6]==2">
					                      <s:set name="url">user/user!singleUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:if>
									   <s:elseif test="#id[6]==3">
									      <s:set name="url">user/user!groupbyUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:elseif>
									   <s:elseif test="#id[6]==4">
									      <s:set name="url">user/user!brandUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:elseif>
				          <li>
					          <div class="pic">
					          <a href="<s:property value="url"/>">
					            <s:if test="#id[3].equals('')">
					                 <img src="uploadFile/img.gif" width=60 height=60/>
					            </s:if>
					            <s:else>
					                 <img src="uploadFile/<s:property  value="#id[3]"/>" width=60 height=60/>
					            </s:else>
					            </a>
					          </div>
		                      <div class="info">
		                         <div class="xin">
				                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
										  <tr>
										    <td width="65%" align="left" valign="middle">
										    <s:property value="#id[2]"/>:<a href="<s:property value="url"/>" class="ziti"><s:property value="#id[4]"/></a>
										    </td>
										   
										  </tr>
				                      </table>
		                         </div>
		                        
											    &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[1]"/>
										
		                      </div> 
							 <div class="clear"></div>
						   </li>
				   </s:iterator>
				  
				  
				  
               </ul>

		</div>
		</div>
		 <div class="ye"> 
		 <s:if test="#request.groupbyCriticismList.size()!=0">
		      <s:set name="pageUrl" >user/user!brandUserCriticism.action?userId=${userId}&currentPage=</s:set>
		      <a href="${pageUrl}1">第一页</a>&nbsp;&nbsp;<a href="${pageUrl}<s:property value="#request.pages.prePage"/>">上一页</a>&nbsp;&nbsp;
		      <s:set name="totalPage" value="#request.pages.totalPage"></s:set>
		      <s:set name="currentPage" value="#request.pages.currentPage"></s:set>
							   <s:if test="#currentPage<=0">
							      <s:set name="currentPage" value="1"></s:set>
							   </s:if>
							   <s:elseif test="#currentPage>#totalPage">
							      <s:set name="currentPage" value="#totalPage"></s:set>
							   </s:elseif>
							   
							   <s:if test="#totalPage%6>0">
							       <s:set name="pageSize" value="#totalPage/6+1"></s:set>
							   </s:if>
							   <s:else>
							       <s:set name="pageSize" value="#totalPage/6"></s:set>
							   </s:else>
							  
							   
							   <s:if test="#currentPage%6>0">
							       <s:set name="cPageSize" value="#currentPage/6+1"></s:set>
							   </s:if>
							   <s:else>
							       <s:set name="cPageSize" value="#currentPage/6"></s:set>
							   </s:else>
							   
							   <s:set name="first" value="6*(#cPageSize-1)"></s:set>
							   <s:if test="#first==0">
							      <s:set name="first" value="1"></s:set>
							   </s:if>
							   <s:set name="last" value="#cPageSize*6"></s:set>
							   <s:if test="#last>#totalPage">
							      <s:set name="last" value="#totalPage"></s:set>
							   </s:if>
				
							     <s:bean name="org.apache.struts2.util.Counter" id="counter"> 
							       <s:param name="first" value="#first"/>
							       <s:param name="last" value="#last" />
							       <s:iterator status="status"> 
							         <s:if test="#currentPage==(#status.index+#first)">
							            &nbsp;&nbsp;<s:a href="%{pageUrl}%{#status.index+#first}" cssStyle="background-color:#982987;color:#FFFFFF; padding-right:3px; padding-left:3px;" ><s:property value="#status.index+#first" /></s:a>
							         </s:if>
							         <s:else>
							            &nbsp;&nbsp;<s:a href="%{pageUrl}%{#status.index+#first}" ><s:property value="#status.index+#first" /></s:a>
							         </s:else>
							       </s:iterator> 
							     </s:bean>
							     <s:if test="#last<#totalPage">
							       ......&nbsp;
							     </s:if>
		      <a href="${pageUrl}<s:property value="#request.pages.nextPage"/>">下一页</a>&nbsp;&nbsp;<a href="${pageUrl}<s:property value="#request.pages.totalPage"/>">最后一页</a>
		   </s:if> 
	   </div> 
		
		<div class="discuss">
		    <div class="discuss_top">添加评论
			</div>
			<form id="form" action="user!addBrandUserCriticism.action" method="post" >
            <input type="hidden" name="userId" value="<s:property value="userId"/>"/>
            <input type="hidden" name="currentPage" value="<s:property value="currentPage"/>"/>
            <script > $(document).ready(function(){$("input[name='url']").val(location.href);})</script>
			<input type="hidden" name="url" />
	        <div class="discuss_con">
	          <textarea name="content" id="content" rows="2" class="texta"></textarea>
	        </div>
         	<div class="discuss_bot"><img src="images/discuss.jpg" onclick="startSubmit()"/> </div>
         </form>
		</div>
</div>
	  
	  
	  
	</div>  
	
	  
</div>


<div id="foot"><jsp:include page="../bot.jsp"></jsp:include></div>


</div>
</body>
</html>

